<?php
namespace Admin\Controller;
use Think\Controller;
class OrderDetController extends CommonController {

    //返回订单详情
    public function getOrderlist($oid){

        $orderDetTab = M('Order_details');
        $where['oid'] = $oid;
        $orderDetRes = $orderDetTab->where($where)
                                    ->field('gid,price,num,total')
                                    ->select();
                                        
        if (!empty($orderDetRes)) {
            foreach ($orderDetRes as $key => $value) {
                $newKey = $orderDetRes[$key]['gid'];
                $newArr[$newKey] = $value; //
            }
            return $newArr;
        }else{
            return array();
        }
    }

    //返回 订单 gid
    public function getOrderGid($oid){
        $orderDetTab = M('Order_details');
        $where['oid'] = $oid;

        $orderGid = $orderDetTab->where($where)->field('gid')->select();

        for ($i=0; $i < count($orderGid) ; $i++) { 
            $gid[] = $orderGid[$i]['gid'];
        }

        return $gid;
    }
    
    //根据 订单号 和 商品gid 查 上报商品的 数目 单价

}